New for Magellan II
Supposing in your ARexx script you wanted to add a file/dir to the Desktop:
Where do you copy the file to?
Do you copy or move it?
How do you tell Opus to add it to the Desktop display?
Supposing you wanted to Drag'n'Drop a file from the Desktop to a custom
handler:
How can you be sure the source path is the Opus Desktop directory?
This is where these three commands, dopus getdesktop ,
dopus checkdesktop and dopus matchdesktop are useful.
When you copy or move a file to the Desktop, they are copied or moved to
this directory. You can check this out for yourself very easily, open two
listers, one with a path of S:, the other with DOpus5:Desktop. Now copy a
file from S: to DOpus5:Desktop, after a few seconds you will see the file
appear on the Desktop, usually with whatever default icon for that type of
file.
If you then use the icons popup menu to delete the file, and rescan the
DOpus5:Desktop lister, you will see that the file has gone.
So by copying things to that directory you can add them to the Desktop,
but how do you find out the directory that the Desktop uses?
dopus getdesktop returns the path of the Opus Desktop directory as
defined in the Environment - Desktop settings, usually the default is
DOpus5:Desktop.
NOTE: The path returned will be the absolute path, for example,
HD0:Opus5/Desktop.
The DOPUSRC variable will contain a value that will indicate what the
default action is for files dropped onto the Desktop. See the example for
the values available.
Example:
/* DopusGetdesktop.dopus5 */
options results
address 'DOPUS.1'
dopus front
dopus getdesktop
text = 'Current Desktop path is: 'result
dopus request '"'text'" OK'
text = 'Popup disabled' /* dopusrc = 0 */
if dopusrc = 1 then text = 'No default action'
if dopusrc = 2 then text = 'Create left-out'
if dopusrc = 3 then text = 'Move to Desktop'
if dopusrc = 4 then text = 'Copy to Desktop'
dopus request '"'text'" OK'
dopus back
exit
If you did the experiment above you noticed that Opus automatically added
the program to the Desktop after a few seconds. This is because Opus uses
file notification on the Desktop directory, when a file gets copied there,
Opus is notified, it rescans the directory and adds any not already on the
Desktop.
However if you copy a directory to the Desktop directory, Opus won't add
it to the Desktop because it doesn't receive notification, this is where the
dopus checkdesktop command is useful.
You give it a path to check, if it matches the one in the environment
settings, it forces Opus to go and check the Desktop directory for any new
items to add to the Desktop.
Example:
/* DopusCheckdesktop.dopus5 */
options results
address 'DOPUS.1'
dopus getdesktop
deskpath = result
address command 'MakeDir 'deskpath'T'
dopus checkdesktop deskpath
text = 'There should be an icon for ''T'' on the Desktop'
dopus request '"'text'" OK'
address command 'Delete 'deskpath'T FORCE QUIET'
dopus checkdesktop deskpath
exit
Supposing you had a custom handler for a lister and you dragged a file
from the Desktop to your lister, Opus would give you the full file and path,
for example, HD0:Desktop/some.file
After separating the path from the file, how could you check that the path
given was the Desktop path that Opus uses?
This is what the dopus matchdesktop command is for, you can give it a
path and it will check it against the path specified for the Desktop in the
environment settings.
Example:
/* DopusMatchdesktop.dopus5 */
options results
address 'DOPUS.1'
dopus front
dopus matchdesktop 'SYS:Prefs'
if result = 1 then
text = 'Your Desktop path is SYS:Prefs, very strange :-/'
else
text = 'Your Desktop path isn''t SYS:Prefs, good :)'
dopus request '"'text'" OK'
dopus back
exit
|